package com.ok.apm.core

import java.util.concurrent.atomic.AtomicBoolean

abstract class IPlugin<T : IPluginConfig> {
    var mPluginConfig: T? = null
    var mIsRunning: AtomicBoolean? = AtomicBoolean(false)
    open fun isRunning(): Boolean {
        return mIsRunning?.get() ?: false
    }

    open fun start() {
        if (isRunning()) return
    }

    open fun stop() {
        if (!isRunning()) return
    }

    open fun destroy() {
        if (!isRunning()) return
    }
}

interface IPluginConfig

interface IReport {
    fun onMessageReport(message: (String) -> Unit) {
    }
    fun onErrorReport(error: (String) -> Unit) {}
}
